<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class Login extends FormRequest
{
    public static $mobilePattern = '/^1\d{10}$/';
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'available' => 'boolean',
            'username' => 'max:16',
            'mobile' => 'regex:'.self::$mobilePattern,
            'password' => 'max:32',
            'email' => 'email|max:128',
            'nickname' => 'max:16'
        ];
    }
}
